#define _CRT_SECURE_NO_WARNINGS
#include"string.h"

namespace zss
{
	strin::strin(const char* str)
		:_size(strlen(str))
	{
		_capacity=_size;
		_str = new char[_size + 1];
		strcpy(_str, str);
	}
	
	//s1(s2)
	strin::strin(const strin& s)
	{
		
		_str = new char[_capacity+1];
		strcpy(_str, s._str);
		_size = s._size;
		_capacity = s._capacity;
		
	}

	//d1=d2
	strin& strin::operator=(const strin& s)
	{
		if (this != &s)
		{
			delete[] _str;
			_str = new char[_capacity + 1];
			strcpy(_str, s._str);
			_size = s._size;
			_capacity = s._capacity;
		}
		return *this;
	}

	strin::~strin()
	{
		delete[] _str;
		_str = nullptr;
		_capacity = 0;
		_size = 0;
	}

	void test1_strin()
	{
		strin s1("hello world");
		const strin s2 = "rll";
		const strin s3("hrlllo");

	}

}